/******************************************************************************* * Copyright (c) 2004, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.tests.decorators; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.IDecoration; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ILightweightLabelDecorator; import org.eclipse.swt.graphics.Font; import org.eclipse.ui.PlatformUI; /** * The FontDecorator is for testing the font enablement. */ public class FontDecorator implements ILightweightLabelDecorator { public static final String ID = "org.eclipse.ui.tests.fontDecorator"; public static Font font; /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, * org.eclipse.jface.viewers.IDecoration) */ public void decorate(Object element, IDecoration decoration) { if(font == null){ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { setUpFont(); } }); } decoration.setFont(font); } /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) */ public void addListener(ILabelProviderListener listener) { // TODO Auto-generated method stub } /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() */ public void dispose() { // TODO Auto-generated method stub } /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, * java.lang.String) */ public boolean isLabelProperty(Object element, String property) { // TODO Auto-generated method stub return false; } /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) */ public void removeListener(ILabelProviderListener listener) { } /** * Setup the font used by this decorator. */ public static void setUpFont() { font = JFaceResources.getFont(JFaceResources.HEADER_FONT); } }